import { defineStore } from "pinia"
import { ref, reactive } from 'vue'

//第一个参数id一般和文件名相同，第二个参数配置项
export const useAxiosStore = defineStore('axios', () => {
    let accessToken = ref('');//令牌
    let refreshToken = ref('');//刷新令牌
    let user = reactive({});//用户信息

    return { accessToken, refreshToken, user }
},
    {
        persist: {
            key: 'TemplateSite', 
            storage: localStorage,
            // 可选：只保存特定字段
            //paths: ['accessToken', 'refreshToken']
        }
    }
)